package com.xzx.study.fragment;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.xzx.study.R;

public class FragmentDemoActivity extends AppCompatActivity implements View.OnClickListener {

    private Button fragment_button1;
    private Button fragment_button2;
    private Button fragment_button3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment);

        fragment_button1 = findViewById(R.id.fragment_button1);
        fragment_button1.setOnClickListener(this);
        fragment_button2 = findViewById(R.id.fragment_button2);
        fragment_button2.setOnClickListener(this);
        fragment_button3 = findViewById(R.id.fragment_button3);
        fragment_button3.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v == fragment_button1) {
            startActivity(new Intent(this, FragmentDemo1Activity.class));
            return;
        }
        if (v== fragment_button2) {
            startActivity(new Intent(this, FragmentDemo2Activity.class));
            return;
        }

        if (v == fragment_button3) {
            startActivity(new Intent(this, FragmentDemo3Activity.class));
            return;
        }
    }
}
